<%-- 
    Document   : registro_comprador
    Created on : 10/03/2009, 10:33:16 PM
    Author     : Ricardo
--%>
<%@page session='true'%>
<%@ include file="conexion.jsp" %> 

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>MarketFarm: Registro Nuevo Producto</title>
    <link rel="STYLESHEET" type="text/css" href="default.css">   
    <head><title>Nuevo Producto</title></head>
    <body><center>
            <h2>Registro de Nuevo Producto</h2>
            <form name=registroProducto method=POST action=procesarProducto.jsp>
                <input type="hidden" name="prov_codigo" value="
                <%  
                    String nick = session.getAttribute("nick").toString();
                    Statement instruccion = null;   
                    ResultSet rs = null;
                    Connection con = getConexion();
                    try{
                        instruccion = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                        //extraemos el codigo de proveedor
                        rs =  instruccion.executeQuery("SELECT p.prov_codigo FROM proveedor p, usuario u where u.usu_nick = '"+nick+"' and u.usu_codigo = p.usu_codigo");
                        while(rs.next()){   
                            out.println(rs.getInt(1));
                        }
                    }   
                    catch(Exception e){out.println(e);} 
                %>
                ">
                <table border=0 cellspacing=3 cellpadding=3>
                    
                    <tr>
                        <td align="right">Nombre comercial:</td>
                        <td align="left"><input type=text name=pro_nombre_comercial size=20></td>
                    </tr>
                    <tr>
                        <td align="right">Registro sanitario:</td>
                        <td align="left"><input type=text name=pro_registro_sanitario size=10></td>
                    </tr>
                    <tr>
                        <td align="right">Clasificación ATC:</td>                        
                        <td align="left"><input type=text name=pro_clasificacion_atc size=25></td>
                    </tr>
                    <tr>
                        <td align="right">Laboratorio:</td>
                        <td align="left">
                            <select name="lab_codigo">
                                <%
                                    instruccion = null;   
                                    rs = null;
                                    con = getConexion();
                                    try{
                                        instruccion = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                                        //extraemos los laboratorios
                                        rs =  instruccion.executeQuery("select * from laboratorio");
                                        while(rs.next()){   
                                            out.println("<option value='"+rs.getInt(1)+"'>"+rs.getString(2)+"</option>");
                                        }
                                    }   
                                    catch(Exception e){out.println(e);}   
                                %>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">Costo unitario:</td>
                        <td align="left"><input type=text name=costo_unitario size=10></td>
                    </tr>
                    <tr>
                        <td align="center" colspan="2">
                            <input type=submit name=boton value="Registrar">
                            <input type=reset name=boton value="Limpiar">
                        </td>
                    </tr>
                 </table>
              </form>
           
            <hr>
            <a href="javascript:history.back()">Regresar</a>
            
        </center>
    </body>
</html>    
